package main

import (
	"60321/pkg/global"
	"60321/pkg/global/client"
	"60321/pkg/queue"
	"60321/pkg/router"
	"60321/pkg/utils"
	"context"
	"time"

	"github.com/gin-gonic/gin"
)

func main() {
	client.InitConfig()
	r := router.SetUpRouter()
	port := "8080"
	r.Use(gin.Logger())
	OrderQueue := queue.NewOrderQueue(global.Mq)
	// 启动后台同步任务(每30秒同步一次)
	go utils.StartEnhancedSyncJob(context.Background(), 30*time.Second)
	go OrderQueue.Consume()
	err := r.Run(":" + port)
	if err != nil {
		panic(err)
	}
}
